Copyright ã1995 by NeXT Computer, Inc.  All Rights Reserved.

NS_DEV_DOCFOR:objc_class:TextFieldCell;,TextFieldCell

Inherits From:	ActionCell : Cell : Object

Declared In:	appkit/TextFieldCell.h

Class Description

A TextFieldCell is simply a text Cell that keeps track of it background and text colors.  Normally, the Cell class assumes white as the background when bezeled, and light gray otherwise, and black text is always used.  With TextFieldCell, you can specify those colors.

Instance Variables

float backgroundGray;

float textGray;

backgroundGray 	The background gray level.

textGray 	The text gray level.

Method Types

Initializing a new TextFieldCell
- init
- initTextCell: 

Copying a TextFieldCell	- copyFromZone:

Setting the TextFieldCell's value
- setFloatValue: (Cell)
- floatValue (Cell)
- setDoubleValue: (Cell)
- doubleValue (Cell)
- setIntValue: (Cell)
- intValue (Cell)
- setStringValue: (Cell)
- setStringValueNoCopy: (Cell)
- setStringValueNoCopy:shouldFree: (Cell)
- stringValue (Cell)

Modifying Graphic Attributes	- setTextColor:
- textColor
- setTextGray: 
- textGray
- setBackgroundColor:
- backgroundColor
- setBackgroundGray: 
- backgroundGray
- setBackgroundTransparent:
- isBackgroundTransparent
- setTextAttributes: 
- setBezeled: 
- isOpaque

Displaying	- drawSelf:inView:
- drawInside:inView: 

Tracking the Mouse	- trackMouse:inRect:ofView:

Archiving	- read: 
- write:

Instance Methods

NS_DEV_DOCFOR:objc_method:[TextFieldCell-backgroundColor];,backgroundColor

- (NXColor)backgroundColor

Returns the color used to draw the background on color displays.

See also:  - setBackgroundColor:, - backgroundGray

NS_DEV_DOCFOR:objc_method:[TextFieldCell-backgroundGray];,backgroundGray

- (float)backgroundGray

Returns the gray level used to draw the background on monochrome displays.  If the gray level is less than 0, then the background is transparent.

See also:  - setBackgroundGray:, - backgroundColor

NS_DEV_DOCFOR:objc_method:[TextFieldCell-copyFromZone:];,copyFromZone:

- copyFromZone:(NXZone *)zone

Creates and returns a new TextFieldCell as a copy of the receiver, allocated from zone.

NS_DEV_DOCFOR:objc_method:[TextFieldCell-drawInside:inView:];,drawInside:inView:

- drawInside:(const NXRect *)cellFrame inView:controlView

Draws the inside of the TextFieldCell (the background and text, but not the bezel or border).  This method is invoked from drawSelf:inView: and also from Control and its subclasses' drawCellInside: method.  If you subclass TextFieldCell, and you override drawSelf:inView:, then you should override this method as well.  Returns self.

See also:  - drawSelf:inView:

NS_DEV_DOCFOR:objc_method:[TextFieldCell-drawSelf:inView:];,drawSelf:inView:

- drawSelf:(const NXRect *)cellFrame inView:controlView

Draws the TextFieldCell's background, text, and border or bezel.  Returns self.

See also:  - drawInside:inView:

NS_DEV_DOCFOR:objc_method:[TextFieldCell-init];,init

- init

Initializes and returns the receiver, a new instance of TextFieldCell, with the default title, ªFieldº.  Other defaults are set as described in initTextCell: below.  

See also:  - initTextCell:

NS_DEV_DOCFOR:objc_method:[TextFieldCell-initTextCell:];,initTextCell:

- initTextCell:(const char *)aString

Initializes and returns the receiver, a new instance of TextFieldCell, with aString as its text. The default text gray is NX_BLACK, and the default background gray is transparent (-1.0).  Its font is set to the user's system font, and the font size is 12.0 point.

This method is the designated initializer for TextFieldCell.  Override this method if you create a subclass of TextFieldCell that performs its own initialization.  Note that TextFieldCell doesn't override Cell's initIconCell: designated initializer; your code shouldn't use that method to initialize an instance of TextFieldCell.

See also:  - init

NS_DEV_DOCFOR:objc_method:[TextFieldCell-isBackgroundTransparent];,isBackgroundTransparent

- (BOOL)isBackgroundTransparent

Returns YES if the background of the TextFieldCell is transparent (that is, if the background gray is less than 0).

See also:  - setBackgroundTransparent:, - setBackgroundGray:

NS_DEV_DOCFOR:objc_method:[TextFieldCell-isOpaque];,isOpaque

- (BOOL)isOpaque

Returns YES if the TextFieldCell draws over every pixel in its frame.  This will be true if the cell is bezeled, or if its background gray is not transparent.

See also:  - setBezeled:, - setBackgroundGray:

NS_DEV_DOCFOR:objc_method:[TextFieldCell-read:];,read:

- read:(NXTypedStream *)stream

Reads the TextFieldCell from the typed stream stream.  Returns self.

See also:  - write:

NS_DEV_DOCFOR:objc_method:[TextFieldCell-setBackgroundColor:];,setBackgroundColor:

- setBackgroundColor:(NXColor)aColor

Sets the background color for the TextFieldCell to aColor.  The background color is used only on color displays; on monochrome displays, the background gray is used.  Returns self.

See also:  - backgroundColor, - setBackgroundGray:

NS_DEV_DOCFOR:objc_method:[TextFieldCell-setBackgroundGray:];,setBackgroundGray:

- setBackgroundGray:(float)value

Sets the gray level that will be used to draw the background on monochrome displays.  If value is less than 0.0, no background will be drawn.  If the cell is editable, it should have a background gray greater than or equal to 0.0.  Returns self.

See also:  - backgroundGray, - setBackgroundColor:

NS_DEV_DOCFOR:objc_method:[TextFieldCell-setBackgroundTransparent:];,setBackgroundTransparent:

- setBackgroundTransparent:(BOOL)flag

If flag is YES, sets the background gray of the TextFieldCell to transparent (a negative value); if NO, sets the background gray to NX_WHITE.  Returns self.

See also:  - setBackgroundGray:

NS_DEV_DOCFOR:objc_method:[TextFieldCell-setBezeled:];,setBezeled:

- setBezeled:(BOOL)flag

If flag is YES, the TextFieldCell is drawn with a bezel around the edge; if NO, nothing is drawn around the text.  If the current background gray is transparent, it's changed to NX_WHITE.  Bezeled transparent TextFieldCells look rather strange, but if you want to have one, invoke setBackgroundGray: with -1.0 after invoking setBezeled:.

See also:  - isBezeled (Cell), - setBackgroundGray:

NS_DEV_DOCFOR:objc_method:[TextFieldCell-setTextAttributes:];,setTextAttributes:

- setTextAttributes:textObject

Used to set the attributes of the field editor when editing the TextFieldCell (see the TextFieldCell class description).  Sets the background and text colors or gray levels of textObject to those of the TextFieldCell, and returns textObject.  textObject should respond to the messages setBackgroundGray:, setBackgroundColor:, setTextGray:, and setTextColor:.  You rarely need to override this method; you never need to invoke it.

If the TextFieldCell is disabled, then 0.333 is added or subtracted to textObject's brightness level so that the brightness is brought toward the background gray level (if the background is transparent, the text is always made darker).  The gray level is never brought below 0.0 or above 1.0 by this adjustment; this can cause brightly colored text on a white background to look no different when the cell is disabled.

Note that if the TextFieldCell has a transparent background, textObject's background gray isn't changed.  Since a TextFieldCell's background is transparent by default, and the field editor's background could be any gray level or color (depending on where it was last used), this can cause ugly side effects.  Editable TextFieldCells should use an opaque background whenever possible in order to avoid this.

See also:  - setTextGray:, - setBackgroundGray:, - setTextAttributes: (Cell)

NS_DEV_DOCFOR:objc_method:[TextFieldCell-setTextColor:];,setTextColor:

- setTextColor:(NXColor)aColor

Sets the color used to draw the text.  On monochrome displays this can result in unsightly dithering of text, so this method should only be used if the drawing view responds YES to a shouldDrawColor message.  setTextColor: doesn't cause the text to be redrawn.  Returns self.

See also:  - textColor, - setTextGray:, - shouldDrawColor (View)

NS_DEV_DOCFOR:objc_method:[TextFieldCell-setTextGray:];,setTextGray:

- setTextGray:(float)value

Sets the gray level used to draw the text, regardless of the color capability of the display.  value should lie in the range 0.0 (indicating black) to 1.0 (indicating white).  To specify one of the four pure shades of gray, use one of these constants:

Constant	Shade 

NX_WHITE	White 
NX_LTGRAY	Light gray 
NX_DKGRAY	Dark gray 
NX_BLACK	Black

A setTextGray: message doesn't cause the text to be redrawn.  Returns self.

See also:  - textGray, - setTextColor:

NS_DEV_DOCFOR:objc_method:[TextFieldCell-textColor];,textColor

- (NXColor)textColor

Returns the color used to draw the text.  Returns self.  

See also:  - setTextColor:, - textGray

NS_DEV_DOCFOR:objc_method:[TextFieldCell-textGray];,textGray

- (float)textGray

Returns the gray level used to draw the text.  Returns self.  

See also:  - setTextGray:, - textColor

NS_DEV_DOCFOR:objc_method:[TextFieldCell-trackMouse:inRect:ofView:];,trackMouse:inRect:ofView:

- (BOOL)trackMouse:(NXEvent*)theEvent
inRect:(const NXRect*)aRect
ofView:controlView

Causes editing to occur, and increments the state of the TextFieldCell if its enabled and the mouse goes up in its frame.  Returns YES if the mouse goes up in the TextFieldCell, NO otherwise.

See also:  - trackMouse:inRect:ofView: (Cell)

NS_DEV_DOCFOR:objc_method:[TextFieldCell-write:];,write:

- write:(NXTypedStream *)stream

Writes the receiving TextFieldCell to the typed stream stream.  Returns self.

See also:  - read: